//体温数据
function getTime(num1, num2) {
    $.ajax({
                url: `${Url}/Wechat/Api/PeriodTemperature?IdentityNo=${theRequest.IdentityNo}&BeginTime=${num1}&EndTime=${num2}`,
                type: 'get',
                datatype: 'json',
                headers: {
                    'Authorization': Authorization
                },
                // data: responseData,
                async: false,
                success: function(res) {
                        var num6 = res.data.TemperatureItems;
                        var CheckDate = [];
                        var Temperature = [];
                        if (num6.length > 0) {
                            $('#tabletext').css('display', 'block')
                            for (let key in num6) {
                                var con = num6[key]
                                var title = '';
                                CheckDate.push(con.CheckDate);
                                Temperature.push(con.Temperature);
                                // if (con.CheckDate > 3.61 && con.CheckDate < 6.11) {
                                //     title = '理想血糖'
                                // } else if (con.CheckDate < 3.61) {
                                //     title = '低于标准值'
                                // } else {
                                //     title = '大于标准值'
                                // }
                            }
                        } else {
                            $('#tabletext').css('display', 'none')
                        }
                        let teplhtml = `
${num6.map(item=>{
return `<tr><td>${item.CheckDate}</td><td>${item.Temperature}</td></tr>`
}).join('')
}
`
            $('#tabletext').html(teplhtml);
            var startLength = 100 - (7 / CheckDate.length * 100);
            var myChart1 = echarts.init(document.getElementById('main1'));

            option1 = {
                title: {
                    text: '体温检测数据',
                    subtext: '额度参考值:35.7°C~37.3°C',
                    x: 'right',

                },
                grid: {


                    top: "30%",
                    right: "0%",
                    bottom: '10%',
                    //     width: "66%",
                    left: "10%",
                    //     containLabel: true,
                    //     height: "55%"
                },
                legend: {
                    orient: 'vertical',
                    x: 'left',
                    y: 'top',
                    data: ['额度'],

                },
                xAxis: {
                    data: CheckDate,
                    show:false,
                    axisLabel: {
                        interval: 0,
                    },
                },
                yAxis: {
                    max: 42,
                    min: 35,
                },
                series: [{
                    name: '额度',
                    type: 'line',
                    data: Temperature,
                    markLine: {
                        symbol: ['none', 'none'], //去掉箭头
                        itemStyle: {
                            normal: {
                                lineStyle: {
                                    type: 'dashed',
                                    color: { //设置渐变
                                        type: 'linear',
                                        // x: 0,
                                        y: 0,
                                        x2: 0,
                                        y2: 1,
                                        colorStops: [{
                                            offset: 0,
                                            color: 'red ' // 0% 处的颜色
                                        }, {
                                            offset: 1,
                                            color: 'red' // 100% 处的颜色
                                        }],
                                        global: false // 缺省为 false
                                    }
                                },
                            }
                        },
                        data: [{
                            yAxis: 35.7,
                        }, {
                            yAxis: 37.3,
                        }]
                    },

                }],
                color: ['#3366CC'],
                tooltip: {
                    trigger: 'axis',
                    axisPointer: {
                        type: 'line'
                    }
                },
                dataZoom: [ //滑动条
                    {
                        type: 'inside',
                        realtime: true,
                        start: startLength,
                        end: 100,
                        startValue: 0
                    }
                ],

            };
            myChart1.setOption(option1);
        }
    })
}
getTime(getPreMonth(), getNowMonth());